/**
 * Created by siqing on 2017/4/16.
 */
function tabTurn(v){
    var div_ = document.getElementsByClassName("hidden_");
    for(var i=0;i<div_.length;i++)
    {
        var _div_ = div_[i];

        if(_div_ == document.getElementById('tab'+v))
        {
            _div_.style.display="block";

        }else{
            _div_.style.display="none";
        }
    }
}

function GameTurn(v){
    var div_ = document.getElementsByClassName("_hidden_");
    for(var i=0;i<div_.length;i++)
    {
        var _div_ = div_[i];
        if(_div_ == document.getElementById('Game'+v))
        {
            _div_.style.display="block";
        }else{
            _div_.style.display="none";
        }
    }
}
/*登录*/
myApp.controller('loginData',function($scope,$http,$filter){
    $scope._login={};
    $scope.trun = function(){
        $scope.isShow = !$scope.isShow;
        $scope.isHide = !$scope.isHide;
        $scope.show = document.getElementById('input_2');
        if( ($scope.isShow ==true)&&($scope.isHide == false))
        {
            $scope.show.type='password';
        }
        if(($scope.isShow ==false)&&($scope.isHide == true)){
            $scope.show.type='text';
        }
    };
    
    $scope.save = function(){
        $http({
            method:'post',
            url:'', /*获取前端信息的后台文件*/
            data:$scope._login,
            header:{
                'Content-Type': 'application/json'
            }
        }).success(function(data,status,headers,config){
            console.log('提交成功');
            console.log($scope._login);
        }).error(function(data,status,headers,config){
            alert('请检查网络');
        })
    }
})
/*注册*/
myApp.controller('SignUpData',function($scope,$http,$filter){
    $scope.Signdata={};

    /*  $scope.save = function(){
     $http({
     method:'post',
     url:'', /!*获取前端信息的后台文件*!/
     data:$scope._login,
     header:{
     'Content-Type': 'application/json'
     }
     }).success(function(data,status,headers,config){
     console.log('提交成功');
     console.log($scope._login);
     }).error(function(data,status,headers,config){
     alert('请检查网络');
     })
     }*/
})
/*王者荣耀*/
myApp.controller('mainForm',function($scope,$http) {
    console.log("执行了控制器");
    $scope.formdata = {};

    $scope.save = function () {
        console.log("可以执行提交表单功能了");
        console.log($scope.formdata);

        if ($scope.FormSubmit.$invalid) {
            alert("请检查你的信息");
        }
        $http({
            method: 'POST',
            url: './gameform.php',
            data: $scope.formdata,
            headers: {
                'Content-Type': 'application/json'
            },
        }).success(function (data, status, headers, config) {
            console.log(data);
            console.log("提交成功");
            alert("提交成功！");

        }).error(function (data, status, headers, config) {
            console.log(data);
            console.log(status);
            alert('请检查网络连接，或者检查资料是否完整')
        })
        console.log("执行了http");


    }
})
/*英雄联盟*/
myApp.controller('LOLForm',function($scope,$http) {
    console.log("执行了控制器");
    $scope.LOLdata = {};

    $scope.save = function () {
        console.log("可以执行提交表单功能了");
        console.log($scope.LOLdata);

        if ($scope.FormSubmit.$invalid) {
            alert("请检查你的信息");
        }
        $http({
            method: 'POST',
            url: './gameform.php',
            data: $scope.LOLdata,
            headers: {
                'Content-Type': 'application/json'
            },
        }).success(function (data, status, headers, config) {
            console.log(data);
            console.log("提交成功");
            alert("提交成功！");

        }).error(function (data, status, headers, config) {
            console.log(data);
            console.log(status);
            alert('请检查网络连接，或者检查资料是否完整')
        })
        console.log("执行了http");


    }
})